package lib.bone.system.extend.domain.entity;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

/**
 * 系统 用户登录日志
 */
@Getter
@Setter
@ToString
@RequiredArgsConstructor
@Entity
@Table(name = "sys_login_log")
@EntityListeners(AuditingEntityListener.class)
public class SysLoginLog {
    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    Long id;

    @Column(name = "user_name",length = 64)
    private String userName;

    @Column(name = "user_id",length = 64)
    private Long userId;

    /** 登录状态 1成功 0失败 */
    @Column(name = "status")
    private Integer status;

    /** 登录IP地址 */
    @Column(name = "ip_addr")
    private String ipAddr;

    /** 登录地点 */
    @Column(name = "login_location")
    private String loginLocation;

    /** 浏览器类型 */
    @Column(name = "browser")
    private String browser;

    /** 操作系统 */
    @Column(name = "os")
    private String os;

    /** 提示消息 */
    @Column(name = "msg")
    private String msg;


    @CreatedDate
    @ApiModelProperty(value = "记录创建时间",name = "createdTime")
    @Column(name = "created_time")
    private Date createdTime;
    @LastModifiedDate
    @ApiModelProperty(value = "记录更新时间",name = "updatedTime")
    @Column(name = "updated_time")
    private Date updatedTime;
}
